home *** CD-ROM | disk | FTP | other *** search
- /*
- **
- ** $VER: openurl.c 0.5 (05.11.02)
- ** Description
- **
- ** (C) Copyright 1999 Paul Hill
- ** (C) Copyright 2002 Alexandre Balaban
- **
- ** $HISTORY :
- ** - 0.5, 05.11.02 : Corrected implicit declaration of printf (from TRACE macro)
- ** - 0.4, 09.10.02 : Improve PPC compilation again
- ** - 0.3, 03.10.02 : Include PPC compilation improvements by Steffen Haeuser
- ** - 0.2, 27.07.02 : Cleanup
- ** - 0.1, 08.03.99 : Original version by Paul Hill
- **
- */
-
- #include <stdio.h>
- #ifndef __PPC__
-
- #include <proto/exec.h>
- #include <libraries/openurl.h>
- #include <proto/openurl.h>
- #include <clib/openurl_protos.h>
- #include <pragmas/openurl_pragmas.h>
-
- #endif // __PPC__
-
- #include "swfplayer.h" // for TRACE macro
-
- #ifndef __PPC__
-
- #pragma tagcall OpenURLBase URL_OpenA 1E 9802
-
- struct Library *OpenURLBase = NULL;
-
- extern __inline BOOL
- URL_OpenA( STRPTR url, struct TagItem *tags)
- {
- register BOOL res __asm("d0");
- register struct Library *a6 __asm("a6") = OpenURLBase;
- register STRPTR a0 __asm("a0") = url;
- register struct TagItem *a1 __asm("a1") = tags;
- __asm volatile ("jsr a6@(-0x1e:W)"
- : "=r" (res)
- : "r" (a6), "r" (a0), "r" (a1)
- : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
- return res;
- }
- #endif // !__PPC__
-
- void showUrl(char *url, char *target, void *client_data)
- {
- TRACE("OPENURL [%s] [%s] [%p]\n",url,target,client_data);
-
- #ifndef __PPC__
- /* attempt to open the OpenUrl.library if it's not already open */
- if (!OpenURLBase)
- {
- OpenURLBase = OpenLibrary("openurl.library", 1);
- }
-
- if (OpenURLBase)
- {
- ULONG tags[] = { URL_NewWindow, FALSE, TAG_DONE };
- if (URL_OpenA((STRPTR)url, (struct TagItem*)&tags))
- {
- TRACE("OK\n");
- }
- }
- else
- {
- printf("GetURL : %s\n", url);
- }
- #endif // !__PPC__
- }
-